#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sqlite3 as dbapi
import os

CONFDIR = os.path.join(os.environ['HOME'], '.eboutique')

db = dbapi.connect(os.path.join(CONFDIR, "db.dat"))
cursor = db.cursor()

cursor.execute("""create table if not exists products (id text,
                  name text, type text, price real, stock int,
                  description text)""")

cursor.execute("""create table if not exists clients (id int,
                  firstname text, secondname text, vip bool, email text,
                  address text)""")
                  
def AddProduct(code, name, type, price, stock, description):
  str = 'insert into products values (\'' + code + '\', \'' + name +
        '\', \'' + type + '\', \'' + str(price) + '\', \'' + str(stock) 
        + '\', \'' + description + '\')'
  cursor.execute(str)
  db.commit()
